package com.qs.home.ui.VM;

import android.databinding.BindingAdapter;
import android.databinding.ObservableField;
import android.support.annotation.NonNull;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.qs.home.entity.TextResultEntity;

import me.goldze.mvvmhabit.base.ItemViewModel;

/**
 * 结果识别item
 *
 * @Author ltzz
 * @Date 2019/8/15
 */
public class IdentifyResultsItemViewModel extends ItemViewModel<IdentifyResultsViewModel> {
    public ObservableField<TextResultEntity> mItemEntity = new ObservableField<>();
    //识别结果
    public ObservableField<String> resultStr = new ObservableField<>("");

    public IdentifyResultsItemViewModel(@NonNull IdentifyResultsViewModel viewModel, TextResultEntity itemEntity) {
        super(viewModel);
        mItemEntity.set(itemEntity);
        if (itemEntity.getWords_result() != null && itemEntity.getWords_result().size() > 0) {
            String result = "";
            for (int i = 0; i < itemEntity.getWords_result().size(); i++) {
                if (i == 0)
                    result = itemEntity.getWords_result().get(i).getWords();
                else
                    result = result  + itemEntity.getWords_result().get(i).getWords();
            }
            resultStr.set(result);
        }
    }

}
